package com.zx.crowdfunding.mapper;

import com.zx.crowdfunding.entity.po.ProjectPO;
import com.zx.crowdfunding.entity.po.ProjectPOExample;
import com.zx.crowdfunding.entity.vo.DetailProjectVO;
import com.zx.crowdfunding.entity.vo.PortalTypeVO;

import java.util.List;
import org.apache.ibatis.annotations.Param;

public interface ProjectPOMapper {
    int countByExample(ProjectPOExample example);

    int deleteByExample(ProjectPOExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(ProjectPO record);

    int insertSelective(ProjectPO record);

    List<ProjectPO> selectByExample(ProjectPOExample example);

    ProjectPO selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") ProjectPO record, @Param("example") ProjectPOExample example);

    int updateByExample(@Param("record") ProjectPO record, @Param("example") ProjectPOExample example);

    int updateByPrimaryKeySelective(ProjectPO record);

    int updateByPrimaryKey(ProjectPO record);

	/**
	 * 保存项目、分类关联关系数据
	 * @param typeIdList 分类id集合
	 * @param projectId	项目id
	 */
	void insertProjectTypeRelationship(@Param("typeIdList") List<Integer> typeIdList, @Param("projectId") Integer projectId);

	/**
	 * 保存项目、标签关联关系数据
	 * @param tagIdList 标签id集合
	 * @param projectId 项目id
	 */
	void insertProjectTagRelationship(@Param("tagIdList") List<Integer> tagIdList, @Param("projectId") Integer projectId);

	/**
	 * 查询门户首页的项目分类列表
	 * @return PortalTypeVO对象集合
	 */
	List<PortalTypeVO> selectPortalTypeVOList();
	
	/**
	 * 查询项目详情页的项目VO对象
	 * @param projectId 项目id
	 * @return DetailProjectVO对象
	 */
	DetailProjectVO selectDetailProjectVO(@Param("id") Integer projectId);

	/**
	 * 更新项目进度
	 * <p>修改已筹集到的金额、支持人数、百分比完成度</p>
	 * @param projectId 项目id
	 */
	void updateProjectProgress(Integer projectId);
}